<template>
  <div class="Pzhanghu">
    <div class="mainTop">
      <div class="img">
        <img src="../assets/images/juzi.png" alt />
        <p>
          你好,
          <router-link to="/home/P_zhanghu/P_personaldata">
            <span>{{userphone}}</span>
          </router-link>
        </p>
      </div>
      <div class="neirong jifen">
        <p>当前积分</p>
        <p class="cheng">{{userintegral}}</p>
      </div>
      <div class="neirong">
        <p>我的钱包</p>
        <p class="cheng">{{usermoney}}</p>
      </div>
      <div class="neirong">
        <router-link to="/home/P_zhanghu/P_chongzhiyoulei">
          <p class="lv">充值有礼>></p>
        </router-link>
        <router-link to="/home/P_zhanghu/P_chongzhiduihuan">
          <p class="cheng">充值卡兑换>></p>
        </router-link>
      </div>
    </div>
    <div class="mainBottom">
      <div class="img2">
        <img src="../assets/images/apple-2.png" alt />
      </div>
    </div>
    <div class="rightCon2">
      <router-view></router-view>
    </div>
  </div>
</template>
<script>
// import Qs from 'qs';
export default {
//   name: "zhanghu",

  data() {
    return {
      userphone:"",
      userintegral:"",
      usermoney:"",
      user:[]
    };
  },
  created(){ 
			var _this=this;
			//var userphone=localStorage.getItem("userphone")
			// window.console.log(userphone)
			// let  data = Qs.stringify({userphone: userphone});
			this.$axios({
				method: "post",
				url: "http://localhost:3000/recentlook",
				// data:data,
				headers: {
					"Content-Type": "application/x-www-form-urlencoded"
				}
			}).then(response => {
        _this.user = response.data.result[0];
        window.console.log(_this.user)
				_this.code = response.data.code;
				_this.userphone=_this.user.userphone;
				_this.userintegral=_this.user.userintegral;
				_this.usermoney=_this.user.usermoney;
				_this.user=_this.$store.state.userinfor;
			})
			.catch(function(error) {
				_this.data = error;
			});
		}

    // var _this=this;
    // var userphone=localStorage.getItem("userphone")
    // this.$axios.post("http://localhost:3000/userinfor",{userphone:userphone})
    // .then(function(response){
    // 	var list=response.data;
    // 	if(list.code==200){
    // 		_this.$store.commit('userinforChang',list.data[0]);
    // 		_this.user=_this.$store.state.userinfor;
    // 	}
    // }).catch(function (error) {
    // 	window.console.log(error);
    // })
  
};
</script>
<style scoped>
.Pzhanghu {
  width: 100%;
  margin-left: 0;
}
.Pzhanghu .mainTop {
  width: 100%;
  background: #f4fff2;
  display: flex;
  border: 1px solid #e7e7e7;
}
.Pzhanghu .mainTop .img {
  margin: 8px 0px 1px 20px;
  display: flex;
}
.Pzhanghu .mainTop .img img {
  height: 130px;
}
.Pzhanghu .mainTop .img p {
  font: 14px/150px "simhei";
  margin-left: 5px;
}
.Pzhanghu .mainTop .img span {
  color: #e96d49;
}
.Pzhanghu .mainTop .neirong {
  margin-left: 8%;
  margin-top: 55px;
}
.Pzhanghu .mainTop .neirong .cheng {
  margin-top: 4px;
  text-align: center;
  color: #e96d49;
}
.Pzhanghu .mainTop .neirong .lv {
  color: #91bc8a;
}
.Pzhanghu .mainTop .jifen {
  margin-left: 15%;
}
.Pzhanghu .mainBottom {
  width: 100%;
  margin-top: 22px;
}
.Pzhanghu .mainBottom .img2 img {
  width: 100%;
}
.rightCon2 {
  position: relative;
}
</style>